www.gusucode.com > VC++ 客户管理系统(SQL Serve)-源码程序 > VC++ 客户管理系统(SQL Serve)-源码程序/code/Program/xlxr.cpp

    // xlxr.cpp : implementation file
//

#include "stdafx.h"
#include "khmanager.h"
#include "xlxr.h"
#include "ado.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// xlxr dialog


xlxr::xlxr(CWnd* pParent /*=NULL*/)
	: CDialog(xlxr::IDD, pParent)
{
	//{{AFX_DATA_INIT(xlxr)
	//}}AFX_DATA_INIT
}


void xlxr::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(xlxr)
	DDX_Control(pDX, IDC_EDIT9, m_edit9);
	DDX_Control(pDX, IDC_EDIT8, m_edit8);
	DDX_Control(pDX, IDC_EDIT7, m_edit7);
	DDX_Control(pDX, IDC_EDIT6, m_edit6);
	DDX_Control(pDX, IDC_EDIT5, m_edit5);
	DDX_Control(pDX, IDC_EDIT4, m_edit4);
	DDX_Control(pDX, IDC_EDIT3, m_edit3);
	DDX_Control(pDX, IDC_EDIT2, m_edit2);
	DDX_Control(pDX, IDC_EDIT1, m_edit1);
	DDX_Control(pDX, IDC_DATETIMEPICKER2, m_date2);
	DDX_Control(pDX, IDC_DATETIMEPICKER1, m_date1);
	DDX_Control(pDX, IDC_COMBO3, m_com3);
	DDX_Control(pDX, IDC_COMBO1, m_com1);
	DDX_Control(pDX, IDC_COMBO2, m_com2);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(xlxr, CDialog)
	//{{AFX_MSG_MAP(xlxr)
	ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// xlxr message handlers

BOOL xlxr::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	this->m_edit1.EnableWindow(false);
	this->m_edit1.SetWindowText(edit1);
	this->m_edit2.SetWindowText(edit2);
	this->m_edit3.SetWindowText(edit3);
	this->m_edit4.SetWindowText(edit4);
	this->m_edit5.SetWindowText(edit5);
	this->m_edit6.SetWindowText(edit6);
	this->m_edit7.SetWindowText(edit7);
	this->m_edit8.SetWindowText(edit8);
	this->m_edit9.SetWindowText(edit9);
	this->m_com1.SetWindowText(com1);
	this->m_com2.SetWindowText(com2);
	this->m_com3.SetWindowText(com3);
	this->m_date1.SetWindowText(date1);
	this->m_date2.SetWindowText(date2);
	this->m_com2.AddString("男");
	this->m_com2.AddString("女");
	this->m_com3.AddString("懂事长");
	this->m_com3.AddString("总经理");
	this->m_com3.AddString("销售主管");
	this->m_com3.AddString("市场主管");
	this->m_com3.AddString("宣传主管");
	this->m_com3.AddString("总工程师");
	this->m_com3.AddString("外联主管");
	this->m_com3.AddString("人力资源主管");
	this->m_com3.AddString("职员");
	ado load;
	load.Open("select * from tb_khxx",adCmdText);
	int rstnum=load.GetRecordCount();
	int l;
	for(l=1;l<=rstnum;l++)
	{
		this->m_com1.AddString(load.GetFieldValue("khxx_mc"));
		load.Move(l);
		
	}

	load.close();
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void xlxr::OnButton2() 
{
this->OnCancel();	
}

void xlxr::OnButton1() 
{

	
	this->m_edit1.GetWindowText(edit1);
	this->m_edit2.GetWindowText(edit2);
	this->m_edit3.GetWindowText(edit3);
	this->m_edit4.GetWindowText(edit4);
	this->m_edit5.GetWindowText(edit5);
	this->m_edit6.GetWindowText(edit6);
	this->m_edit7.GetWindowText(edit7);
	this->m_edit8.GetWindowText(edit8);
	this->m_edit9.GetWindowText(edit9);
	this->m_com1.GetWindowText(com1);
	this->m_com2.GetWindowText(com2);
	this->m_com3.GetWindowText(com3);
	this->m_date1.GetWindowText(date1);
	this->m_date2.GetWindowText(date2);
	ado xlxrrst;
	xlxrrst.rstOpen("select * from tb_Client_lxrxx");
	CString ss;
	ss.Format("UPDATE tb_Client_lxrxx set lxrxx_qymc='%s',lxrxx_xm='%s',lxrxx_xb='%s',lxrxx_nl='%s',lxrxx_zw='%s',lxrxx_bgdh='%s',lxrxx_Email='%s',lxrxx_csny='%s',lxrxx_sj='%s',lxrxx_grjj='%s',lxrxx_djrq='%s',lxrxx_xxdjr='%s',lxrxx_bz='%s' where lxrxx_id='%s'",com1,edit2,com2,edit3,com3,edit4,edit5,date1,edit6,edit7,date2,edit8,edit9,edit1);
	xlxrrst.ExecuteSQL(ss);
	MessageBox("修改成功","提示");
}

BOOL xlxr::PreTranslateMessage(MSG* pMsg) 
{
	// TODO: Add your specialized code here and/or call the base class
	if(pMsg->message==WM_KEYDOWN && pMsg->wParam==13)
		pMsg->wParam=9;		
	return CDialog::PreTranslateMessage(pMsg);
}